package com.woniu.guoguo.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.guoguo.controller.component.OrderInfo;
import com.woniu.guoguo.model.Order;
import com.woniu.guoguo.dao.OrderMapper;
import com.woniu.guoguo.service.IOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Richie
 * @since 2020-11-02
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Order findOrderByUserIdAndMenuId(int menuId, int userId) {

        return orderMapper.findOrderByUserIdAndMenuId(menuId,userId);
    }

    @Override
    public void updateStateTo3ById(Integer orderId) {
        orderMapper.updateStateTo3ById(orderId);
    }

    @Override
    public IPage<OrderInfo> find(Page<OrderInfo> page, String description, int userId) {
        IPage<OrderInfo> iPage = orderMapper.findOrder(page, description, userId);
        return iPage;
    }

    @Override
    public void changeOrder(Order order) {
        orderMapper.changeOrder(order);
    }

    @Override
    public void changeShop(Order order) {
        orderMapper.changShop(order);
    }

    @Override
    public void changUser(Order order) {
        orderMapper.changeUser(order);
    }

    @Override
    public void addAOrderBuySys(Order order) {
        orderMapper.addAOrderBuySys(order);
    }

    @Override
    public Order findOrderByOutTradeNo(String otn) {
        return orderMapper.findOrderByOutTradeNo(otn) ;
    }

}
